<?php
/**
 * 用户答题组记录表
 */
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUserQuestionTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_question', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->comment('用户ID');
            $table->mediumText('questions')->comment('题信息 json格式');
            $table->tinyInteger('status')->default(1)->comment('是否答题 1未答题 2已答题');
            $table->tinyInteger('answer_result')->default(1)->comment('答题结果 1全对 2有误');
            $table->timestamps();
            $table->softDeletes();
        });
        //添加表注释
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `".config('database.connections.mysql.prefix')."user_question` comment'题库表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_question');
    }
}
